package com.yxhl.zoume.utils;

import android.content.Context;

import com.github.pwittchen.prefser.library.Prefser;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/11/1 .
 */
public class SplashUtils {
    private static final String IMAGE_URL_KEY = "IMGULR";
    private static final String TARGET_URL_KEY = "TARGET_URL";
    private static SplashUtils instance = null;
    private Prefser prefser;

    public SplashUtils(Context context) {
        if (null == prefser) {
            prefser = new Prefser(context);
        }
    }

    public static SplashUtils getInstance(Context context) {
        if (instance == null) {
            synchronized (SplashUtils.class) {
                if (instance == null) {
                    instance = new SplashUtils(context);
                }
            }
        }
        return instance;
    }

    public void saveImgUrl(String imgUrl) {
        prefser.put(IMAGE_URL_KEY, imgUrl);
    }

    public String getImgUrl() {
        String imgUrl = prefser.get(IMAGE_URL_KEY, String.class, "");
        return imgUrl;
    }

    public void saveTargetUrl(String targetUrl) {
        prefser.put(TARGET_URL_KEY, targetUrl);
    }

    public String getTargetUrl() {
        String targetUrl = prefser.get(TARGET_URL_KEY, String.class, "");
        return targetUrl;
    }
}